import React, { Component } from 'react'
import {Link, BrowserRouter, Route} from "react-router-dom"   // 分别暴露
import Home from "./components/Home"
import About from "./components/About"

export default class App extends Component {
  render() {
    return (
      <div>
        <div className="row">
          <div className="col-xs-8 col-md-8 col-lg-8 offset-xs-2 offset-md-2 offset-lg-2">
            <div className="page-header"><h2>React Router Demo</h2></div>
          </div>
        </div>
        <div className="row">
          <div className="col-xs-2 col-md-2 col-lg-2 offset-xs-2 offset-md-2 offset-lg-2">
            <div className="list-group">
              {/* 原生html中，靠<a>跳转不同的页面 */}
              {/* <a className="list-group-item" href=" . / about.html">About</a>
              <a className="list-group-item active" href=" . / home.html">Home</a> */}

              {/* 在React中靠路由链接实现切换组件--编写路由链接 */}
              {/* <BrowserRouter> */}
                <Link className="list-group-item" to="/about">About</Link>
                <Link className="list-group-item" to="/home">Home</Link>
              {/* </BrowserRouter> */}
            </div>
          </div>
          <div className="col-xs-6 col-md-6 col-lg-6 col-xs-offset-2 col-md-offset-2 col-lg-offset-2">
            <div className="panel">
              <div className="pane1-body">
                {/* 注册路由 */}
                {/* <BrowserRouter> */}
                  <Route path="/about" component={About}></Route>
                  <Route path="/home" component={Home}></Route>
                {/* </BrowserRouter> */}
              </div>
            </div>
          </div>
        </div>
      </div>
    )
  }
}
